'''
首次进入APP服务协议和隐私政策弹窗
'''
from appium.webdriver.common.mobileby import MobileBy
from Base.basepage import BasePage
from common.LoggerUtil import LogUtils


class AgrePage(BasePage):

    loc_dialog_title = (MobileBy.ID,"com.youth.startup:id/dialog_title")
    loc_text_confirm = (MobileBy.ID,"com.youth.startup:id/text_confirm")
    loc_text_cancle = (MobileBy.ID,"com.youth.startup:id/text_cancle")


    def agre_page(self):
        try:
            res = self.locator(self.loc_dialog_title)
            if res.text == '服务协议和隐私政策':
                LogUtils.info('弹窗页：%s', res.text)
                self.locator(self.loc_text_confirm).click()
            else:
                LogUtils.info('无弹窗')
        except :
            LogUtils.info('-----无协议弹窗，正常执行测试用例~')

